#
# -= Makefile for application compile =-
#
# Note:
# . This is the second part of two makefile components;
#   Please refer "Makefile" for the other part.
#
# Usage:
# . Name this file as "Makefile";
#   Put it in the same directory as application's source code.
# . Change the ROOT definition, if necessary;
#   Make it point to the root of the software tree.
# . Take application as a module, define the name in MOD;
#   There should be NO duplicated module names in the whole project.
# . List all files want to be compiled in ASMS and/or SRCS;
#   Including files, such as header files, must NOT be listed here.
# . List all library files this module may depends on in LIBS.
# . Give a new name in SMOD, if want to include sub-directories;
#   Write the linkage information at the end of file.
#

# Destination to the root of software tree
ROOT = ../..

# List of source files
ASMS = 
SRCS =

# List of library files
LIBS = liblog.a

# List of dependent modules
DMOD =


LMOD = OSAL_NOS VERSION_INFO BOOT_CHIP LLD_PAN_HWSCAN
SMOD = BOOT_BOOT36 BOOT_STANDBY BOOT_SLOT3602

RELPROJ = ${BASE_DIR}

SDKLIB = libboot

# Following lines are the common description for all projects.
# Do NOT modify anything, unless you know what you are doing.
include ${ROOT}/src/path.def
include ${ROOT}/src/compiler.def

OBJS = ${ASMS:.S=.o} ${SRCS:.c=.o}
SMOD_ = ${SMOD:=_}
DMOD_ = ${DMOD:=_}
RMOD_ = ${RMOD:=_}
LMOD_ = ${LMOD:=_}

all:
	rm -f ${LIB_DIR}/list.ddk
	cd ${ROOT}/src; \
	  ${MAKE} ${SMOD} ${LMOD}
	cd ${LIB_DIR}; \
	  echo SDK = \\ > ${SDKLIB}.mak; \
	  echo cat \\ > cat.sh; \
	  cat list.ddk >> cat.sh; \
	  echo \>\> ${SDKLIB}.mak >> cat.sh; \
	  sh < cat.sh; \
	  rm -f cat.sh
	echo "#" >> ${LIB_DIR}/${SDKLIB}.mak
	echo all: >> ${LIB_DIR}/${SDKLIB}.mak
	echo "	${AR} -r ${SDKLIB}.a \$${SDK}" >> ${LIB_DIR}/${SDKLIB}.mak
	cd ${LIB_DIR}; \
	  ${MAKE} -f ${SDKLIB}.mak	
	cp ${LIB_DIR}/${SDKLIB}.a ${BLSDK_DIR}/	
#	cp -f ${SDK_DIR}/${LIBS} ${BLSDK_DIR}/
	rm -f ${LIB_DIR}/${SDKLIB}.mak
	rm -f ${LIB_DIR}/${SDKLIB}.a

clean:
	cd ${BLSDK_DIR}; \
	  rm -f *.a *.o
	cd ${ROOT}/src; \
	  ${MAKE} ${SMOD_} ${LMOD_};

new : clean
	cd ${ROOT}/src; \
	  ${MAKE} ${DMOD_} ${RMOD_}
	  
# End of common description.


